//
//  SmallStrategyTableViewCell.m
//  Qyer
//
//  Created by 赵宇 on 15/9/16.
//  Copyright (c) 2015年 赵宇. All rights reserved.
//

#import "SmallStrategyTableViewCell.h"
#import "BaseHeader.h"
@implementation SmallStrategyTableViewCell
-(instancetype)initWithStyle:(UITableViewCellStyle)style reuseIdentifier:(NSString *)reuseIdentifier
{
    self = [super initWithStyle:style reuseIdentifier:reuseIdentifier];
    if (self) {
        self.picView = [[UIImageView alloc]initWithFrame:CGRectMake(0, 0,SCREEN_WIDTH, SCREEN_HEIGHT/3)];
        [self.contentView addSubview:self.picView];
        
        self.countLabel = [[UILabel alloc]initWithFrame:CGRectMake(SCREEN_HEIGHT/2-10, 30, 50, 30)];
        self.countLabel.backgroundColor = [UIColor colorWithRed:0/255. green:0/255. blue:0/255. alpha:.3];
        self.countLabel.font = [UIFont systemFontOfSize:22.];
        self.countLabel.textAlignment = YES;
        self.countLabel.textColor = [UIColor whiteColor];
        [self.contentView addSubview:self.countLabel];
        UILabel *label = [[UILabel alloc]initWithFrame:CGRectMake(SCREEN_HEIGHT/2-10, 60, 50, 30)];
        label.text = @"旅行地";
        label.backgroundColor = [UIColor colorWithRed:0/255. green:0/255. blue:0/255. alpha:.3];
        label.textAlignment = YES;
        label.font = [UIFont systemFontOfSize:13.];
        label.textColor = [UIColor whiteColor];
        [self.contentView addSubview:label];
        
        self.userPhoto = [[UIImageView alloc]initWithFrame:CGRectMake(20, self.picView.frame.size.height - SCREEN_WIDTH/16, SCREEN_WIDTH/8, SCREEN_WIDTH/8)];
        self.userPhoto.layer.masksToBounds = YES;
        self.userPhoto.layer.cornerRadius = self.userPhoto.frame.size.height/2;
        [self.contentView addSubview:self.userPhoto];
        
        self.usernameLabel = [[UILabel alloc]initWithFrame:CGRectMake(20 + self.userPhoto.frame.size.width, self.picView.frame.size.height, 160, 30)];
        self.usernameLabel.textColor = [UIColor grayColor];
        [self.contentView addSubview:self.usernameLabel];
        
        self.titleLabel = [[UILabel alloc]initWithFrame:CGRectMake(20, self.userPhoto.frame.origin.y+SCREEN_HEIGHT / 10, 300, 30)];
        [self.contentView addSubview:self.titleLabel];
        
    }
    return self;
}
-(void)getValueWithModel:(SmallStrategyModel *)model
{
    NSURL *url = [NSURL URLWithString:model.photo];
    [self.picView sd_setImageWithURL:url placeholderImage:[UIImage imageNamed:@"zhanweiPic"]];
    self.titleLabel.text = model.title;
    self.usernameLabel.text = model.username;
    NSURL *userUrl = [NSURL URLWithString:model.avatar];
    [self.userPhoto sd_setImageWithURL:userUrl placeholderImage:[UIImage imageNamed:@"zhanweiPic"]];
    self.countLabel.text = model.count;
    
}
- (void)awakeFromNib {
    // Initialization code
}

- (void)setSelected:(BOOL)selected animated:(BOOL)animated {
    [super setSelected:selected animated:animated];

    // Configure the view for the selected state
}

@end
